package com.spring.mvc.controller;

import com.spring.mvc.controller.pojo.Goods;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * @auther 尚智江
 * @Date 2022/10/31 0:09
 */
public class AddGoodsServlet extends HttpServlet {
    @Override
    public void doGet(HttpServletRequest request, HttpServletResponse response)throws ServletException, IOException {
        doPost(request,response);
    }
    @Override
    public void doPost(HttpServletRequest request, HttpServletResponse response)throws ServletException, IOException{
        request.setCharacterEncoding("utf-8");
        String goodsName= request.getParameter("goodsname");
        String goodsPrice= request.getParameter("goodsprice");
        String goodsNumber= request.getParameter("goodsnumber");
        int newgoodsnumber = Integer.parseInt(goodsName);
        Double newgoodsPrice = Double.parseDouble(goodsPrice);
        Goods goods = new Goods(goodsName,newgoodsPrice,newgoodsnumber);
    }
}
